package org.seckill.enums;

public enum SeckillEnum {
	SUCCESS(1,"秒杀成功"),
	END(0,"秒杀结束"),
	REPEARKILL(-1,"重复秒杀"),
	INNERERROR(-2,"系统错误"),
	DATAREWRITE(-3,"数据篡改");
	
	private int state;
	private String stateInfo;
	
	private SeckillEnum(int state, String stateInfo) {
		this.state = state;
		this.stateInfo = stateInfo;
	}
	public int getState() {
		return state;
	}
	public void setState(int state) {
		this.state = state;
	}
	public String getStateInfo() {
		return stateInfo;
	}
	public void setStateInfo(String stateInfo) {
		this.stateInfo = stateInfo;
	}
	
	public static String getStateInfo(int state){
		for(SeckillEnum seckillEnum:values()){
			if (seckillEnum.getState() == state) {
				return seckillEnum.getStateInfo();
			}
		}
		return null;
	}
}
